//通过JSON正反序列化来深度克隆对象
export function deepCopyObject<T extends Object>(source : T) : T {
    return JSON.parse(JSON.stringify(source))
}

//比较两同类型对象是否有差异 true:存在差异
export function isDifference<T extends Object>(source : T, target : T) : boolean {
    const keys = Reflect.ownKeys(source)
    for (let key of keys) {
        if (Reflect.get(source, key) !== Reflect.get(target, key)) {
            return true
        }
    }
    return false
}
